package fr.cephb.joperon.core.entities;


import com.sleepycat.db.DatabaseEntry;
import com.sleepycat.db.DatabaseException;
import fr.cephb.joperon.core.entities.base.BasePrjMgr;


/**
 * PrjMgr
 * Description: Project manager
 */
public class PrjMgr
	extends BasePrjMgr
	{
	public final static int PUBLIC_VIEW=0;
	public final static int ADMIN_VIEW=101610724;
	/**
     *
     * Constructor
     *
     */
	public PrjMgr()
		{
		super();
		setView(PUBLIC_VIEW);
		}


        /**
         *
         * Copy Constructor
         *
         */
		public PrjMgr(BasePrjMgr cp)
			{
			super(cp);
			}
		
		/**
		 * constructor from a database entry
		 *
		 */
		public PrjMgr(DatabaseEntry entry) throws DatabaseException
			{
			super(entry);
			}
		
        /**
         *
         * clone
         *
         */
		public Object clone()
			{
			return new PrjMgr(this);
			}

		public boolean isPublic()
			{
			return getView()==PUBLIC_VIEW;
			}
		
		public boolean isAdmin()
			{
			return getView()==ADMIN_VIEW;
			}
		
		@Override
		public int hashCode() {
			return getPid()==null?-1:getPid().hashCode();
			}
		
		@Override
		public boolean equals(Object obj) {
			if(this==obj) return true;
			if(obj==null || obj.getClass()!=this.getClass()) return false;
			return getPid().equals(PrjMgr.class.cast(obj).getPid());
			}
		
		}

